/*
 * Copyright 2011 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.bsc.mgwt.client.ui;

import org.bsc.mgwt.client.css.AppBundle;
import org.bsc.mgwt.client.place.Tab2Place;
import org.bsc.mgwt.client.widget.explorer.MVPExplorerPanel;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Composite;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.dom.client.event.tap.TapHandler;
import com.googlecode.mgwt.mvp.client.AnimatableDisplay;
import com.googlecode.mgwt.mvp.client.display.AnimatableDisplayWithoutAnimation;
import com.googlecode.mgwt.ui.client.widget.Button;

/**
 * Sample implementation of {@link MVPExplorerView}.
 */
public class MVPExplorerViewImpl extends Composite implements MVPExplorerView {
	private Presenter listener;

	
	final MVPExplorerPanel explorerPanel = 
			//new MVPExplorerPanel( AppBundle.INSTANCE.explorerCss(), (AnimatableDisplay) GWT.create(AnimatableDisplay.class) );
			new MVPExplorerPanel( AppBundle.INSTANCE.explorerCss(), new AnimatableDisplayWithoutAnimation() );
	
	public MVPExplorerViewImpl() {
		
		
		Button button = new Button("test");
		button.addTapHandler( new TapHandler() {
			
			@Override
			public void onTap(TapEvent event) {
				listener.goTo( new Tab2Place("explorer") );				
			}
		});
		
		explorerPanel.getLeftWidget().add( button );
		//explorerPanel.setHeight("100%");
		
		
		initWidget( explorerPanel );
	
	}

	@Override
	public void setName(String name) {
	}
	
	@Override
	public void setPresenter(Presenter listener) {
		this.listener = listener;
	}

	@Override
	public AnimatableDisplay getDisplay() {
		return explorerPanel.getAnimatableDisplay();
	}


}
